<?php

namespace Common\Bundle\UserBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="utilisateur")
 * @ORM\Entity(repositoryClass="Common\Bundle\UserBundle\Entity\Repository\UserRepository")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**   
     *  @ORM\Column(name="prenom", type="string", length=255)    
     * 
     */
    private $prenom;

     /**   
     *  @ORM\Column(name="nom", type="string", length=255)
     * 
     */
    private $nom;

    /**   
     *  @ORM\Column(name="motDePasseHorsLigne", type="string", length=255)
     * 
     */
    private $motDePasseHorsLigne;

    /**
     * @var Theme
     *
     * @ORM\ManyToMany(targetEntity="\Common\Bundle\LibraryBundle\Entity\Theme", cascade={"persist"}, mappedBy="users")
     */
    private $themes;

    /**
     * @var Qcm
     *
     * @ORM\OneToMany(targetEntity="\Common\Bundle\LibraryBundle\Entity\Qcm", cascade={"persist"}, mappedBy="user")
     */
    private $qcms;

    /**
     * @var Statistique
     *
     * @ORM\OneToMany(targetEntity="\Common\Bundle\LibraryBundle\Entity\Statistique", cascade={"persist"}, mappedBy="user")
     */
    private $statistiques;

    /**
     * Add themes
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Theme $theme
     * @return User
     */
    public function addTheme(\Common\Bundle\LibraryBundle\Entity\Theme $themes)
    {
        $this->themes[] = $themes;

        return $this;
    }

    /**
     * Remove themes
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Theme $themes
     */
    public function removeTheme(\Common\Bundle\LibraryBundle\Entity\Theme $themes)
    {
        $this->themes->removeElement($themes);
    }

    /**
     * @return \Common\Bundle\LibraryBundle\Entity\Theme
     */
    public function getThemes()
    {
        return $this->themes;
    }

    /**
     * Add qcms
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Qcm $qcms
     * @return User
     */
    public function addQcm(\Common\Bundle\LibraryBundle\Entity\Qcm $qcms)
    {
        $this->qcms[] = $qcms;

        return $this;
    }

    /**
     * Remove qcms
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Qcm $qcms
     */
    public function removeQcm(\Common\Bundle\LibraryBundle\Entity\Qcm $qcms)
    {
        $this->qcms->removeElement($qcms);
    }

    /**
     * @return \Common\Bundle\LibraryBundle\Entity\Qcm
     */
    public function getQcms()
    {
        return $this->qcms;
    }

     /**
     * Add statistiques
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Statistiques $statistique
     * @return User
     */
    public function addstatistique(\Common\Bundle\LibraryBundle\Entity\Statistique $statistiques)
    {
        $this->statistiques[] = $statistiques;

        return $this;
    }

    /**
     * Remove statistiques
     *
     * @param \Common\Bundle\LibraryBundle\Entity\Statistique $statistiques
     */
    public function removeStatistique(\Common\Bundle\LibraryBundle\Entity\Statistique $statistiques)
    {
        $this->statistiques->removeElement($statistiques);
    }

    /**
     * @return \Common\Bundle\LibraryBundle\Entity\Statistique
     */
    public function getStatistiques()
    {
        return $this->statistiques;
    }

    /**
     * Get nom
     * @return string
     */
    public function getNom(){
        return $this->nom;
    }

    /**
     * Set nom
     * @param string $nom
     */

    public function setNom($nom){
       $this->nom = $nom;
    }

    /**
     * Get prenom
     * @return string
     */
    public function getPrenom(){
        return $this->prenom;
    }

    /**
     * Set prenom
     * @param string $prenom
     */

    public function setPrenom($prenom){
       $this->prenom = $prenom;
    }

    /**
     * Get motDePasseHorsLigne
     * @return string
     */
    public function getMotDePasseHorsLigne(){
        return $this->motDePasseHorsLigne;
    }

    /**
     * Set motDePasseHorsLigne
     * @param string $motDePasseHorsLigne
     */

    public function setMotDePasseHorsLigne($motDePasseHorsLigne){
        $this->motDePasseHorsLigne = md5($motDePasseHorsLigne);
    }

}